<template>
  <ul class="context-menu-container">
    <li @click="onReflesh">刷新</li>
    <li @click="onCloseRight">关闭右侧</li>
    <li @click="onCloseOther">关闭其他</li>
  </ul>
</template>

<script setup>
import { defineProps } from 'vue'
import { useRouter } from 'vue-router'
import { useStore } from 'vuex'
const props = defineProps({
  index: {
    type: Number,
    required: true
  }
})
const router = useRouter()
const store = useStore()
const onReflesh = () => {
  router.go(0)
}

const onCloseRight = () => {
  store.commit('app/removeTagsView', { type: 'right', index: props.index })
}

const onCloseOther = () => {
  store.commit('app/removeTagsView', { type: 'other', index: props.index })
}
</script>

<style lang="scss" scoped>
.context-menu-container {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 999;
  background: #fff;
  width: 80px;
  border-radius: 4px;
  padding: 4px 0;
  user-select: none;
  list-style: none;
  box-shadow: 2px 2px 3px rgba(0, 0, 0, .3);
  li {
    line-height: 1.8;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    &:hover {
      background-color: #d9dfec;
    }
  }
}
</style>
